Skip to content

List: Allow selection/highlighting of text in an item [QW] \ Implementation#32840

Merged
dmlvr merged 10 commits intoDevExpress:26_1from
dmlvr:26_1_3648_list_highlighting_text_of_the_items
Mar 13, 2026
Merged

List: Allow selection/highlighting of text in an item [QW] \ Implementation#32840
dmlvr merged 10 commits intoDevExpress:26_1from
dmlvr:26_1_3648_list_highlighting_text_of_the_items

Conversation

@dmlvr
Copy link
Contributor

@dmlvr dmlvr commented Mar 10, 2026

No description provided.

@dmlvr dmlvr self-assigned this Mar 10, 2026
@dmlvr dmlvr added the 26_1 label Mar 10, 2026
@dmlvr dmlvr requested a review from a team as a code owner March 10, 2026 08:28
Copilot AI review requested due to automatic review settings March 10, 2026 08:28
@dmlvr dmlvr requested a review from a team as a code owner March 10, 2026 08:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts dxList swipe wiring to better support use cases like text selection within list items by removing the internal _swipeEnabled switch and only attaching swipe listeners when there is an onItemSwipe subscription. It also updates Scheduler tooltip list options/tests accordingly.

Changes:

  • Removed the internal _swipeEnabled option from ListBase and stopped passing it from Scheduler tooltip list creation.
  • Updated ListBase to attach swipe event handlers only when onItemSwipe is subscribed.
  • Updated affected QUnit tests to reflect the new options shape (and attempted to update a swipe-related List test).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
packages/devextreme/testing/tests/DevExpress.ui.widgets/listParts/commonTests.js Updates a List swipe test (currently inconsistent with actual options/behavior).
packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/desktopTooltip.tests.js Updates assertions for Scheduler tooltip List options after removing _swipeEnabled.
packages/devextreme/js/__internal/ui/list/list.base.ts Removes _swipeEnabled and changes swipe listener attachment to depend on action subscription.
packages/devextreme/js/__internal/scheduler/tooltip_strategies/m_tooltip_strategy_base.ts Stops passing _swipeEnabled: false into tooltip List options.

Copilot AI review requested due to automatic review settings March 10, 2026 13:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


return result;
}

Copy link
Contributor

@pharret31 pharret31 Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there any tests that checks resubscriptions in existing tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have test which checks onItemSwipe subscription by on method

QUnit.test('onItemSwipe - subscription by on method', function(assert) {

Copilot AI review requested due to automatic review settings March 12, 2026 16:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


You can also share your feedback on Copilot code review. Take the survey.

pointerMock($item).start().down(0, 0).move(50, 0).up();

assert.strictEqual(window.getSelection().toString(), textNode.nodeValue.slice(0, 4), 'text selection is preserved after horizontal drag');
window.getSelection().removeAllRanges();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You already call removeAllRanges at the module level inside the afterEach hook

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed all extra calls


const { $item, textNode } = getFirstListItemAndTextNode(this.element);
assert.ok(!!textNode, 'text node found in list item');
if(!textNode) return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need to return here? I would prefer to remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

});

const { $item, textNode } = getFirstListItemAndTextNode(this.element);
assert.ok(!!textNode, 'text node found in list item');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to use strictEqual() instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

const result = super.on(eventName, eventHandler);

const isItemSwipeOn = eventName === 'itemSwipe'
|| (isPlainObject(eventName) && Object.prototype.hasOwnProperty.call(eventName, 'itemSwipe'));
Copy link
Contributor

@EugeniyKiyashko EugeniyKiyashko Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
|| (isPlainObject(eventName) && Object.prototype.hasOwnProperty.call(eventName, 'itemSwipe'));
|| (isPlainObject(eventName) && Object.hasOwn(eventName, 'itemSwipe'));

Copy link
Contributor Author

@dmlvr dmlvr Mar 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Is the follow checking enough?

(isPlainObject(eventName) && ('itemSwipe' in eventName));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

returned

Object.prototype.hasOwnProperty.call(eventName, 'itemSwipe')

on(eventName: string | { [key: string]: Function }, eventHandler?: Function): this {
const result = super.on(eventName, eventHandler);

const isItemSwipeOn = eventName === 'itemSwipe'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const isItemSwipeOn = eventName === 'itemSwipe'
const hasItemSwipeHandler = eventName === 'itemSwipe'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed

@dmlvr dmlvr force-pushed the 26_1_3648_list_highlighting_text_of_the_items branch from 0b422d2 to 2f7a9a5 Compare March 13, 2026 08:42
Copilot AI review requested due to automatic review settings March 13, 2026 08:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


You can also share your feedback on Copilot code review. Take the survey.

Copilot AI review requested due to automatic review settings March 13, 2026 08:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


You can also share your feedback on Copilot code review. Take the survey.

@dmlvr dmlvr merged commit edb1a98 into DevExpress:26_1 Mar 13, 2026
130 of 131 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants